//! 提供了开发工具宏
//!
//! 用于快速创建 sgs_core::pkg::Package 类型
//!
//!

/// 生成 Package 的声明宏
///
/// ## example
///
/// ```no_run
///use sgs_core::pkg::*;
///impl Provider for YourPackage {
///     // more code ...
///     fn provide_package(&self) -> Package {
///         create_package! {
///             self,
///             version => "0.0.1",
///             tag => "sgs_pkg_std",
///             name => "三国杀标准包" ,
///             desp => "三国杀官方标准包的 rust 实现",
///         }
///     }
/// }
/// ```
#[macro_export]
macro_rules! create_package {

    () => {{
        $crate::pkg::Package::default()
    }};

    ($pkg:expr, $($key:ident => $val:expr),+ $(,)?) => {{
        let mut _package = create_package!();
        _package.cards= $pkg.provide_cards();
        _package.roles= $pkg.provide_roles();
        _package.patterns= $pkg.provide_patterns();
        $(_package.$key = $val.into();)+

        _package
    }};


    ($($key:ident => $val:expr),+ $(,)?) => {{
        let mut _package = create_package!();
        $(_package.$key = $val.into();)+
        _package
    }};
}

#[cfg(test)]
mod test {

    #[test]
    fn test_create_package_macro() {
        unimplemented!()
    }
}
